package com.weic.flink.dataset.source

import org.apache.flink.api.scala._

/**
 * @Auther:BigData-weic
 * @ClassName:Demo02FileSourceOps
 * @Date:2020/12/16 22:27
 * @功能描述: $FunctionDescription
 * @Version:1.0
 */
object Demo02FileSourceOps {

	def main(args: Array[String]): Unit = {
		val env = ExecutionEnvironment.getExecutionEnvironment
		//从文件中读取数据
		val lines = env.readTextFile("file:\\F:\\datas\\wc\\input_wc\\a.txt")
		val ret = lines.flatMap(_.split("\\s+"))
			.map((_, 1))
			.groupBy(0)
			.sum(1)
		ret.print()
	}
}
